home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / gfx / misc / gnuplot-3.7src.lha / gnuplot-3.7src / gnuplot-3.7.lha / gnuplot-3.7 / win / wgnuplib.h < prev    next >
C/C++ Source or Header  |  1998-12-10  |  10KB  |  360 lines

  1. /*
  2.  * $Id: wgnuplib.h,v 1.10 1998/03/22 22:35:27 drd Exp $
  3.  */
  4.  
  5. /* GNUPLOT - win/wgnuplib.h */
  6.  
  7. /*[
  8.  * Copyright 1982 - 1993, 1998   Russell Lang
  9.  *
  10.  * Permission to use, copy, and distribute this software and its
  11.  * documentation for any purpose with or without fee is hereby granted,
  12.  * provided that the above copyright notice appear in all copies and
  13.  * that both that copyright notice and this permission notice appear
  14.  * in supporting documentation.
  15.  *
  16.  * Permission to modify the software is granted, but not the right to
  17.  * distribute the complete modified source code.  Modifications are to
  18.  * be distributed as patches to the released version.  Permission to
  19.  * distribute binaries produced by compiling modified sources is granted,
  20.  * provided you
  21.  *   1. distribute the corresponding source modifications from the
  22.  *    released version in the form of a patch file along with the binaries,
  23.  *   2. add special version identification to distinguish your version
  24.  *    in addition to the base release version number,
  25.  *   3. provide your name and address as the primary contact for the
  26.  *    support of your modified version, and
  27.  *   4. retain our contact information in regard to use of the base
  28.  *    software.
  29.  * Permission to distribute the released version of the source code along
  30.  * with corresponding source modifications in the form of a patch file is
  31.  * granted with same provisions 2 through 4 for binary distributions.
  32.  *
  33.  * This software is provided "as is" without express or implied warranty
  34.  * to the extent permitted by applicable law.
  35. ]*/
  36.  
  37. /*
  38.  * AUTHORS
  39.  * 
  40.  *   Russell Lang
  41.  * 
  42.  * Send your comments or suggestions to 
  43.  *  info-gnuplot@dartmouth.edu.
  44.  * This is a mailing list; to join it send a note to 
  45.  *  majordomo@dartmouth.edu.  
  46.  * Send bug reports to
  47.  *  bug-gnuplot@dartmouth.edu.
  48.  */
  49.  
  50. /* this file contains items to be visible outside wgnuplot.dll */
  51.  
  52. #ifdef _WINDOWS
  53. #define _Windows
  54. #endif
  55.  
  56. #ifdef __DLL__
  57. #define WINEXPORT _export
  58. #else
  59. #define WINEXPORT
  60. #endif
  61.  
  62. #define WDPROC WINAPI WINEXPORT
  63.  
  64. #define WGNUPLOTVERSION  "1.2   1996-01-18"
  65. BOOL WDPROC CheckWGNUPLOTVersion(LPSTR str);
  66.  
  67. /* ================================== */
  68. /* symbols for the two icons          */
  69. #define TEXTICON 123
  70. #define GRPICON 124
  71.  
  72. /* ================================== */
  73. /* For WIN32 API's */
  74. #ifdef WIN32
  75. /* #define DEFAULT_CHARSET ANSI_CHARSET */
  76. #define OFFSETOF(x)  (x)
  77. #define SELECTOROF(x)  (x)
  78. #define MoveTo(hdc,x,y) MoveToEx(hdc,x,y,(LPPOINT)NULL);
  79. # ifndef __TURBOC__ /* Borland C has these defines, already... */
  80. #define farmalloc(x) malloc(x)
  81. #define farrealloc(s,n) realloc(s,n)
  82. #define farfree(s) free(s)
  83. # endif /* __TURBOC__ */
  84. #endif
  85.  
  86. #ifdef __MINGW32__
  87. /* HBB 980809: MinGW32 doesn't define some of the more traditional
  88.  * things gnuplot expects in every Windows C compiler, it seems: */
  89. typedef LOGPEN *LPLOGPEN;
  90. typedef HGLOBAL GLOBALHANDLE;
  91. #define WINVER 0x0400
  92. #define HFILE_ERROR ((HFILE)-1)
  93.  
  94. /* the far mem/string function family: */
  95. #define _fstrstr(s1,s2) (strstr(s1,s2))
  96. #define _fstrchr(s,c) (strchr(s,c))
  97. #define _fstrrchr(s,c) (strrchr(s,c))
  98. #define _fstrlen(s) (strlen(s))
  99. #define _fstrcpy(d,s) (strcpy(d,s))
  100. #define _fstrncpy(d,s,n) (strncpy(d,s,n))
  101. #define _fstrcat(s1,s2) (strcat(s1,s2))
  102. #define _fmemset(s,c,n) (memset(s,c,n))
  103. #define _fmemmove(d,s,n) (memmove(d,s,n))
  104.  
  105. #endif /* __MINGW32__ */
  106. /* ================================== */
  107. /* wprinter.c - windows printer routines */
  108. void WDPROC DumpPrinter(HWND hwnd, LPSTR szAppName, LPSTR szFileName);
  109.  
  110. typedef struct tagPRINT {
  111.     HDC        hdcPrn;
  112.     HWND    hDlgPrint;
  113.     BOOL    bUserAbort;
  114.     POINT    pdef;
  115.     POINT    psize;
  116.     POINT    poff;
  117.     struct tagPRINT FAR *next;
  118. } PRINT;
  119. typedef PRINT FAR*  LPPRINT;
  120.  
  121. /* ================================== */
  122. /* wpause.c - pause window structure */
  123. typedef struct tagPW
  124. {
  125.     HINSTANCE    hInstance;        /* required */
  126.     HINSTANCE    hPrevInstance;    /* required */
  127.     LPSTR    Title;            /* required */
  128.     LPSTR    Message;        /* required */
  129.     POINT    Origin;            /* optional */
  130.     HWND    hWndParent;        /* optional */
  131.     HWND    hWndPause;
  132.     HWND    hOK;
  133.     HWND    hCancel;
  134.     BOOL    bPause;
  135.     BOOL    bPauseCancel;
  136.     BOOL    bDefOK;
  137.     WNDPROC    lpfnOK;
  138.     WNDPROC    lpfnCancel;
  139.     WNDPROC    lpfnPauseButtonProc;
  140. } PW;
  141. typedef PW FAR*  LPPW;
  142.  
  143. int WDPROC PauseBox(LPPW lppw);
  144.  
  145. /* ================================== */
  146. /* wmenu.c - menu structure */
  147. #define BUTTONMAX 10
  148. typedef struct tagMW
  149. {
  150.     LPSTR    szMenuName;        /* required */
  151.     HMENU    hMenu;
  152.     BYTE FAR * FAR *macro;
  153.     BYTE FAR *macrobuf;
  154.     int        nCountMenu;
  155.     DLGPROC    lpProcInput;
  156.     char    *szPrompt;
  157.     char    *szAnswer;
  158.     int        nChar;
  159.     int        nButton;
  160.     HWND    hButton[BUTTONMAX];
  161.     int        hButtonID[BUTTONMAX];
  162.     WNDPROC    lpfnMenuButtonProc;
  163.     WNDPROC    lpfnButtonProc[BUTTONMAX];
  164. } MW;
  165. typedef MW FAR * LPMW;
  166.  
  167. /* ================================== */
  168. /* wtext.c text window structure */
  169. /* If an optional item is not specified it must be zero */
  170. #define MAXFONTNAME 80
  171. typedef struct tagTW
  172. {
  173.     LPPRINT    lpr;            /* must be first */
  174.     HINSTANCE hInstance;        /* required */
  175.     HINSTANCE hPrevInstance;    /* required */
  176.     LPSTR    Title;            /* required */
  177.     LPMW    lpmw;            /* optional */
  178.     POINT    ScreenSize;        /* optional */
  179.     unsigned int KeyBufSize;    /* optional */
  180.     LPSTR    IniFile;        /* optional */
  181.     LPSTR    IniSection;        /* optional */
  182.     LPSTR    DragPre;        /* optional */
  183.     LPSTR    DragPost;        /* optional */
  184.     int        nCmdShow;        /* optional */
  185.     FARPROC shutdown;        /* optional */
  186.     HICON    hIcon;            /* optional */
  187.     LPSTR   AboutText;        /* optional */
  188.     HMENU    hPopMenu;
  189.     HWND    hWndText;
  190.     HWND    hWndParent;
  191.     POINT    Origin;
  192.     POINT    Size;
  193.     BYTE FAR *ScreenBuffer;
  194.     BYTE FAR *AttrBuffer;
  195.     BYTE FAR *KeyBuf;
  196.     BYTE FAR *KeyBufIn;
  197.     BYTE FAR *KeyBufOut;
  198.     BYTE    Attr;
  199.     BOOL    bFocus;
  200.     BOOL    bGetCh;
  201.     BOOL    bSysColors;
  202.     HBRUSH    hbrBackground;
  203.     char    fontname[MAXFONTNAME];    /* font name */
  204.     int        fontsize;                /* font size in pts */
  205.     HFONT    hfont;
  206.     int        CharAscent;
  207.     int        ButtonHeight;
  208.     int        CaretHeight;
  209.     int        CursorFlag;
  210.     POINT    CursorPos;
  211.     POINT    ClientSize;
  212.     POINT    CharSize;
  213.     POINT    ScrollPos;
  214.     POINT    ScrollMax;
  215.     POINT    MarkBegin;
  216.     POINT    MarkEnd;
  217.     BOOL    Marking;
  218. } TW;
  219. typedef TW FAR*  LPTW;
  220.  
  221.  
  222. /* ================================== */
  223. /* wtext.c - Text Window */
  224. void WDPROC TextMessage(void);
  225. int WDPROC TextInit(LPTW lptw);
  226. void WDPROC TextClose(LPTW lptw);
  227. void WDPROC TextToCursor(LPTW lptw);
  228. int WDPROC  TextKBHit(LPTW);
  229. int WDPROC TextGetCh(LPTW);
  230. int WDPROC TextGetChE(LPTW);
  231. LPSTR WDPROC TextGetS(LPTW lptw, LPSTR str, unsigned int size);
  232. int WDPROC TextPutCh(LPTW, BYTE);
  233. int WDPROC TextPutS(LPTW lptw, LPSTR str);
  234. void WDPROC TextGotoXY(LPTW lptw, int x, int y);
  235. int  WDPROC TextWhereX(LPTW lptw);
  236. int  WDPROC TextWhereY(LPTW lptw);
  237. void WDPROC TextCursorHeight(LPTW lptw, int height);
  238. void WDPROC TextClearEOL(LPTW lptw);
  239. void WDPROC TextClearEOS(LPTW lptw);
  240. void WDPROC TextInsertLine(LPTW lptw);
  241. void WDPROC TextDeleteLine(LPTW lptw);
  242. void WDPROC TextScrollReverse(LPTW lptw);
  243. void WDPROC TextAttr(LPTW lptw, BYTE attr);
  244. void WDPROC AboutBox(HWND hwnd, LPSTR str);
  245.  
  246. /* ================================== */
  247. /* wgraph.c - graphics window */
  248.  
  249. /* windows data */
  250. #define WGNUMPENS 15
  251.  
  252. #define GWOPMAX 4096
  253. /* GWOP is 8 bytes long. Array of GWOP kept in global block */
  254. struct GWOP {
  255.     WORD op;
  256.     WORD x, y; 
  257.     HLOCAL htext;
  258. };
  259.  
  260. /* memory block for graph operations */
  261. struct GWOPBLK {            /* kept in local memory */
  262.     struct GWOPBLK *next;
  263.     HGLOBAL hblk;            /* handle to a global block */
  264.     struct GWOP FAR *gwop;    /* pointer to global block if locked */
  265.     UINT used;                /* number of GWOP's used */
  266. };
  267.  
  268. /* ops */
  269. #define W_endoflist 0
  270. #define W_dot 10
  271. #define W_diamond 11
  272. #define W_plus 12
  273. #define W_box 13
  274. #define W_cross 14
  275. #define W_triangle 15
  276. #define W_star 16
  277. #define W_circle 17
  278. #define W_fcircle 18
  279. #define W_fbox 19
  280. #define W_fdiamond 20
  281. #define W_fitriangle 21
  282. #define W_itriangle 22
  283. #define W_move 30
  284. #define W_vect 31
  285. #define W_line_type 32
  286. #define W_put_text 33
  287. #define W_justify 34
  288. #define W_text_angle 35
  289. #define W_pointsize 36
  290.  
  291. typedef struct tagGW {
  292.     LPPRINT    lpr;            /* must be first */
  293.     HINSTANCE    hInstance;        /* required */
  294.     HINSTANCE    hPrevInstance;    /* required */
  295.     LPSTR    Title;            /* required */
  296.     int        xmax;            /* required */
  297.     int        ymax;            /* required */
  298.     LPTW    lptw;        /* optional */  /* associated text window */
  299.     POINT    Origin;        /* optional */    /* origin of graph window */
  300.     POINT    Size;        /* optional */    /* size of graph window */
  301.     LPSTR    IniFile;    /* optional */
  302.     LPSTR    IniSection;    /* optional */
  303.     HWND    hWndGraph;    /* window handle */
  304.     HMENU    hPopMenu;    /* popup menu */
  305.     int        numsolid;    /* number of solid pen styles */
  306.     int        pen;        /* current pen number */
  307.     int        htic;        /* horizontal size of point symbol (xmax units) */
  308.     int     vtic;        /* vertical size of point symbol (ymax units)*/
  309.     int        hchar;        /* horizontal size of character (xmax units) */
  310.     int        vchar;        /* vertical size of character (ymax units)*/
  311.     int        angle;        /* text angle */
  312.     BOOL    rotate;        /* can text be rotated 90 degrees ? */
  313.     char    fontname[MAXFONTNAME];    /* font name */
  314.     int        fontsize;    /* font size in pts */
  315.     HFONT    hfonth;        /* horizonal font */
  316.     HFONT    hfontv;        /* vertical font */
  317.     BOOL    resized;    /* has graph window been resized? */
  318.     BOOL    graphtotop;    /* bring graph window to top after every plot? */
  319.     BOOL    color;                    /* color pens? */
  320.     HPEN    hbpen;                    /* border pen */
  321.     HPEN    hapen;                    /* axis pen */
  322.     HPEN    hpen[WGNUMPENS];        /* pens */
  323.     LOGPEN    colorpen[WGNUMPENS+2];    /* logical color pens */
  324.     LOGPEN    monopen[WGNUMPENS+2];    /* logical mono pens */
  325.     COLORREF background;            /* background color */
  326.     HBRUSH   hbrush;                /* background brush */
  327.     HBRUSH   colorbrush[WGNUMPENS+2];   /* brushes to fill points */
  328.     struct GWOPBLK *gwopblk_head;
  329.     struct GWOPBLK *gwopblk_tail;
  330.     unsigned int nGWOP;
  331.     BOOL    locked;                /* locked if being written */
  332.     double  org_pointsize;        /* Original Pointsize */
  333. } GW;
  334. typedef GW FAR*  LPGW;
  335.  
  336. #define WINFONTSIZE 10
  337. #define WIN30FONT "Courier"
  338. #define WINFONT "Arial"
  339.  
  340. #ifndef LEFT
  341. #define LEFT 0
  342. #endif
  343. #ifndef CENTRE
  344. #define CENTRE 1
  345. #endif
  346. #ifndef RIGHT
  347. #define RIGHT 2
  348. #endif
  349.  
  350. void WDPROC GraphInit(LPGW lpgw);
  351. void WDPROC GraphClose(LPGW lpgw);
  352. void WDPROC GraphStart(LPGW lpgw, double pointsize);
  353. void WDPROC GraphEnd(LPGW lpgw);
  354. void WDPROC GraphResume(LPGW lpgw);
  355. void WDPROC GraphOp(LPGW lpgw, WORD op, WORD x, WORD y, LPSTR str);
  356. void WDPROC GraphPrint(LPGW lpgw);
  357. void WDPROC GraphRedraw(LPGW lpgw);
  358.  
  359. /* ================================== */
  360.